set more off
* scheme available here: net describe gr0070, from(http://www.stata-journal.com/software/sj17-3)
set scheme plotplain
*set scheme s1mono

*Load data
use "US_public_replication_data.dta", clear


***************************************************************************************
                      *ANALYSIS FOR MAIN MANUSCRIPT
***************************************************************************************

************************
 *TABLE 2 US DATA*
************************
	*Own Mask Use 
	summ yourmaskuse 
	*Others Mask Use
	summ othersmaskuse
	*Masks Protect You in Control Group
	summ mskblfs_prtctyou if T_mask_protectyou == 0 & T_mask_protectother == 0
	*Masks Protect You in Control Group
	summ mskblfs_prtctyou if T_mask_protectyou == 0 & T_mask_protectother == 0

**************************************************
    *FIGURE 1 PANEL A US ANALYSIS AND FIGURE*
**************************************************

*Analysis for Figure 1 Panel A (Table appears in S3 Appendix ,columns 1-4 of beliefs analysis)
	foreach var of varlist mskblfs_prtctothers binary_mskblfs_prtctothers mskblfs_prtctyou binary_mskblfs_prtctyou {
		regress `var' T_mask_protectyou T_mask_protectother  age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
		sum `var' if e(sample)
	}

*Make Figure 1 Panel A
	coefplot mskblfs_prtctothers binary_mskblfs_prtctothers mskblfs_prtctyou binary_mskblfs_prtctyou, keep(T_mask_protectyou T_mask_protectother) levels(95) omitted baselevels xline(0) title("Panel A: Effect of Mask Treatment on Beliefs (US)") xtitle("Change in Outcome", size(small)) legend(order(2 "Masks Protect Others" 4 "Masks Protect Others Binary" 6 "Masks Protect You" 8 "Masks Protect You Binary") size(small) on) xlabel(, labels labsize(small)) ylabel(, labels labsize(small)) name(Figure1_PanelA, replace) 
	
	graph export figures\Figure1_PanelA.pdf, replace

	
	
**************************************************
    *FIGURE 2 PANEL A and Panel C US DATA*
**************************************************

*Analysis for Figure 2 Panel A (Table appears in S3 Appendix, columns 1-4 of self outcome analysis)
	foreach var of varlist pool_self pool_self_binary pool_self_alt_bin {
		regress `var' T_mask_protectyou T_mask_protectother pool_self_others pool_self_scenario_atm pool_self_scenario_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
		sum `var' if e(sample)
	}

*Make Figure 2 Panel A
	coefplot pool_self pool_self_binary pool_self_alt_bin, keep(T_* pool_self_others) levels(95) omitted baselevels xline(0) title("Panel A: US Pooled Scenarios, Own Mask Behavior") legend(order(2 "Pooled Self Action Scale 1-4" 4 "Pooled Self Action Binary" 6 "Pooled Self Action Alt. coding Binary (leave or mask)") size(vsmall) on) xtitle("Change in Outcome", size(small)) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(Figure2_PanelA, replace) 

	graph export figures\Figure2_PanelA.pdf, replace


*Analysis for Figure 2 Panel C (Table appears in S3 appendix, columns 1 & 2 of other outcome analysis)
	foreach var of varlist pool_other pool_other_binary {
		regress `var' T_mask_protectyou T_mask_protectother pool_other_others pool_other_scenario_atm pool_other_scenario_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
		sum `var' if e(sample)
	}

*Make Figure 2 Panel C
	coefplot pool_other pool_other_binary, keep(T_* pool_other_others) levels(95) omitted baselevels xline(0) title("Panel C: US Pooled Scenarios, Action Toward Other") legend(order(2 "Pooled other Action Scale 1-4" 4 "Pooled other Action Binary") size(vsmall) on) xtitle("Change in Outcome", size(small)) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(Figure2_PanelC, replace) 

	graph export figures\Figure2_PanelC.pdf, replace

**************************************************
    *FIGURE 3 PANEL A and Panel C US DATA*
**************************************************

*Analysis for Figure 3 Panel A (Table appears in S3 appendix column 1 of third party analysis)
	regress pool_3Pnegjudge T_mask_protectyou T_mask_protectother pool_3Pothers pool_3P_atm pool_3P_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
	est store pool_3Pnegjudge
	lincom T_mask_protectyou-T_mask_protectother
	sum pool_3Pnegjudge if e(sample)
	
*Make Figure 3 Panel A
	coefplot pool_3Pnegjudge, keep(T_mask_protectyou T_mask_protectother pool_3Pothers) levels(95) omitted baselevels xline(0) title("Panel A: US Pooled Scenarios" "3rd Party Judgment of Person Wearing Mask Incorrectly", size(small)) legend(order(2 "Negative Judgment Scale") size(vsmall) on) xtitle("Change in Outcome", size(small)) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(Figure3_PanelA, replace) 
	graph export figures\Figure3_PanelA.pdf, replace

*Analysis for Figure 3 Panel C (Table appears in S3 appendix column 2 of third party analysis)
	regress pool_3Pactionnegjudge T_mask_protectyou T_mask_protectother pool_3Pothers pool_3P_atm pool_3P_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if pool_3P_askfixmask==1, robust
	est store pool_3Pnegjudge_fix
	lincom T_mask_protectyou-T_mask_protectother
	sum pool_3Pactionnegjudge if e(sample)

	*Make Figure 3 Panel C
	coefplot pool_3Pnegjudge_fix, keep(T_mask_protectyou T_mask_protectother pool_3Pothers) levels(95) omitted baselevels xline(0) title("Panel C: US Pooled Scenarios" "3rd Party Judgment of Person Who Asked to Fix Mask", size(small)) legend(order(2 "Negative Judgment Scale") size(vsmall) on) xtitle("Change in Outcome", size(small)) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(Figure3_PanelC, replace) 
	graph export figures\Figure3_PanelC.pdf, replace
	


**********************************************************************************************************
                                      *END ANALYSIS FOR MAIN MANUSCRIPT*
**********************************************************************************************************


**********************************************************************************************************
                                      *START ANALYSIS FOR S4 Appendix*
**********************************************************************************************************
	
*Analysis for first S4 Appendix Figure that subsets data to examining respondents who saw the Self scenario first
	foreach var of varlist pool_self pool_self_binary pool_self_alt_bin {
		regress `var' T_mask_protectyou T_mask_protectother pool_self_others pool_self_scenario_atm pool_self_scenario_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if (FirstScenario == 1 & atmtreatment ==0)|(FirstScenario == 2 & parktreatment == 0)|(FirstScenario == 3 & meetingtreatment == 0), robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*Make US side of first S4 Appendix Figure
	coefplot pool_self pool_self_binary pool_self_alt_bin, keep(T_* pool_self_others) levels(95) omitted baselevels xline(0) title("Pooled Scenarios: Own Mask Behavior", size(small)) legend(order(2 "Pooled Self Action Scale 1-4" 4 "Pooled Self Action Binary" 6 "Pooled Self Action Alt. coding Binary (leave or mask)") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(pool_self_first, replace) 
	graph export figures\Pooled_Self_First.pdf, replace


*Analysis for second S4 Appendix Figure that subsets data to examining respondents who saw the Other scenario first
	foreach var of varlist pool_other pool_other_binary {
		regress `var' T_mask_protectyou T_mask_protectother pool_other_others pool_other_scenario_atm pool_other_scenario_meet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if (FirstScenario == 1 & atmtreatment ==1)|(FirstScenario == 2 & parktreatment == 1)|(FirstScenario == 3 & meetingtreatment == 1), robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*Make US side of second S4 Appendix Figure
	coefplot pool_other pool_other_binary, keep(T_* pool_other_others) levels(95) omitted baselevels xline(0) title("Pooled Scenarios: Action toward other", size(small)) legend(order(2 "Pooled other Action Scale 1-4" 4 "Pooled other Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(pool_other_first, replace) 
	graph export figures\Pooled_Other_First.pdf, replace

**********************************************************************************************************
                                      *END ANALYSIS FOR S4 Appendix*
**********************************************************************************************************


**********************************************************************************************************
                                      *START ANALYSIS FOR S5 Appendix*
**********************************************************************************************************


****Start with ATM Scenarios****
* S5 Appendix ATM Scenario Self and Other Analysis
	foreach var of varlist atmself atmself_binary atmother atmother_binary {
		regress `var' T_mask_protectyou T_mask_protectother T_atm_othersinline age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*ATM Self figure
	coefplot atmself atmself_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("ATM Scenario: Own Mask Behavior", size(small)) legend(order(2 "ATM Self Action Scale 1-4" 4 "ATM Self Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(atm_self, replace) 
	graph export figures\ATM_Self.pdf, replace

*ATM Other figure
	coefplot atmother atmother_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("ATM Scenario: Action toward other", size(small)) legend(order(2 "ATM Other Action Scale 1-4" 4 "ATM Other Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(atm_other, replace) 
	graph export figures\ATM_Other.pdf, replace

*ATM Third Party Judgment for Not Wearing a Mask and also Reckless Item Analysis
	foreach var of varlist atm3P_negjudgescale atm3P_notmask_rckls {
		regress `var' T_mask_protectyou T_mask_protectother T_atm_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*ATM Third Party Judgment and Reckless Figure
	coefplot atm3P_negjudgescale atm3P_notmask_rckls, keep(T_*) levels(95) omitted baselevels xline(0) title("ATM Scenario: 3rd Party Behavior (Judge person not wearing mask correctly)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(atm_3pnomask, replace) 
	graph export figures\atm_3pnomask.pdf, replace

* ATM Person Asked to Fix Mask Analysis 
	foreach var of varlist atm3P_actionnegjudge atm3P_action_agrsv atm3P_action_rckls {
		regress `var'  T_mask_protectyou T_mask_protectother T_atm_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if T_thirdpartyatmaction==4, robust
		est store `var'_fix
		lincom T_mask_protectyou-T_mask_protectother
	}

*ATM Person Asked to Fix Mask Figure
	coefplot atm3P_actionnegjudge_fix atm3P_action_agrsv_fix atm3P_action_rckls_fix, keep(T_*) levels(95) omitted baselevels xline(0) title("ATM Scenario: 3rd Party Behavior (Judge person asking person to fix mask)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Aggressive" 6 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(atm_3p_askmask, replace) 
	graph export figures\atm_3p_askmask.pdf, replace
	
****Park Scenarios****

* S5 Appendix PARK Scenario Self and Other Analysis
	foreach var of varlist parkself parkself_binary parkother parkother_binary {
		regress `var' T_mask_protectyou T_mask_protectother T_park_othersatpark age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*PARK Self figure
	coefplot parkself parkself_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("Park Scenario: Own Mask Behavior", size(small)) legend(order(2 "Park Self Action Scale 1-4" 4 "Park Self Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(park_self, replace) 
	graph export figures\Park_Self.pdf, replace

*PARK Other figure	
	coefplot parkother parkother_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("Park Scenario: Action toward other", size(small)) legend(order(2 "Park Other Action Scale 1-4" 4 "Park Other Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(park_other, replace) 
	graph export figures\Park_Other.pdf, replace

*PARK Third Party Judgment for Not Wearing a Mask and also Reckless Item Analysis
	foreach var of varlist park3P_negjudgescale park3P_notmask_rckls {
		regress `var'  T_mask_protectyou T_mask_protectother T_park_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*PARK Third Party Judgment and Reckless Figure
	coefplot park3P_negjudgescale park3P_notmask_rckls, keep(T_*) levels(95) omitted baselevels xline(0) title("PARK Scenario: 3rd Party Behavior (Judge person not wearing mask correctly)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(park_3pnomask, replace) 
	graph export figures\park_3pnomask.pdf, replace

*PARK Person Asked to Fix Mask Analysis
	foreach var of varlist park3P_actionnegjudge park3P_action_agrsv park3P_action_rckls {
		regress `var' T_mask_protectyou T_mask_protectother T_park_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if T_thirdpartyparkaction==4, robust
		est store `var'_fix
		lincom T_mask_protectyou-T_mask_protectother
	}

*PARK Person Asked to Fix Mask Figure
	coefplot park3P_actionnegjudge_fix park3P_action_agrsv_fix park3P_action_rckls_fix, keep(T_*) levels(95) omitted baselevels xline(0) title("PARK Scenario: 3rd Party Behavior (Judge person asking person to fix mask)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Aggressive" 6 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(park_3p_askmask, replace) 
	graph export figures\park_3p_askmask.pdf, replace

****MEET Scenarios****

* S5 Appendix MEET Scenario Self and Other Analysis
	foreach var of varlist meetself meetself_binary meetother meetother_binary {
		regress `var' T_mask_protectyou T_mask_protectother T_meet_othersatmeet age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*MEET Self figure
	coefplot meetself meetself_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("Meeting Scenario: Own Mask Behavior", size(small)) legend(order(2 "Meet Self Action Scale 1-4" 4 "Meet Self Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(meet_self, replace) 
	graph export figures\Meeting_Self.pdf, replace

*MEET Other figure
	coefplot meetother meetother_binary, keep(T_*) levels(95) omitted baselevels xline(0) title("Meeting Scenario: Action toward other", size(small)) legend(order(2 "Meet Other Action Scale 1-4" 4 "Meet Other Action Binary") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) name(meet_other, replace) 
	graph export figures\Meeting_Other.pdf, replace

*MEET Third Party Judgment for Not Wearing a Mask and also Reckless Item Analysis
	foreach var of varlist meet3P_negjudgescale meet3P_notmask_rckls {
		regress `var'  T_mask_protectyou T_mask_protectother T_meet_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine, robust
		est store `var'
		lincom T_mask_protectyou-T_mask_protectother
	}

*MEET Third Party Judgment and Reckless Figure
	coefplot meet3P_negjudgescale meet3P_notmask_rckls, keep(T_*) levels(95) omitted baselevels xline(0) title("Meeting Scenario: 3rd Party Behavior (Judge person not wearing mask correctly)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(meet_3pnomask, replace) 
	graph export figures\meet_3pnomask.pdf, replace

*MEET Person Asked to Fix Mask Analysis
	foreach var of varlist meet3P_actionnegjudge meet3P_action_agrsv meet3P_action_rckls {
		regress `var'  T_mask_protectyou T_mask_protectother T_meet_others age i.female lucid_hhi lucid_incmissing i.ethnicity education ib4.lucid_party i.workstatus c.fluvaccine if T_thirdpartymeetaction==4, robust
		est store `var'_fix
		lincom T_mask_protectyou-T_mask_protectother
	}

*MEET Person Asked to Fix Mask Figure
	coefplot meet3P_actionnegjudge_fix meet3P_action_agrsv_fix meet3P_action_rckls_fix, keep(T_*) levels(95) omitted baselevels xline(0) title("Meeting Scenario: 3rd Party Behavior (Judge person asking person to fix mask)", size(small)) legend(order(2 "Negative Judgment Scale" 4 "Person Aggressive" 6 "Person Reckless") size(vsmall) on) note(Omitted masks treatment category is control) xlabel(, labels labsize(vsmall)) ylabel(, labels labsize(small)) xsize(7) name(meet_3p_askmask, replace) 
	graph export figures\meet_3p_askmask.pdf, replace
		
**********************************************************************************************************
                                      *END ANALYSIS FOR S5 Appendix*
**********************************************************************************************************

	

